package com.ctshk.rpc.hotel.service.impl;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.IsDeletedCode;
import com.ctshk.common.enums.SystemError;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.model.TokenUser;
import com.ctshk.common.utils.EntityUtil;
import com.ctshk.rpc.hotel.APIUtils.APIAesUtil;
import com.ctshk.rpc.hotel.APIUtils.APISignUtil;
import com.ctshk.rpc.hotel.dto.*;
import com.ctshk.rpc.hotel.dto.chimelongProxy.ProxyDatas;
import com.ctshk.rpc.hotel.entity.*;
import com.ctshk.rpc.hotel.mapper.*;
import com.ctshk.rpc.hotel.req.ChimeLongOrderUpdateReq;
import com.ctshk.rpc.hotel.req.ChimeLongProductPriceAndStockReq;
import com.ctshk.rpc.hotel.req.ChimelongProtocalReq;
import com.ctshk.rpc.hotel.req.HotelOrderReq;
import com.ctshk.rpc.hotel.req.chimeLongPriceDate.PersonAccompanying;
import com.ctshk.rpc.hotel.req.chimeLongPriceDate.PriceData;
import com.ctshk.rpc.hotel.req.chimeLongPriceDate.StockData;
import com.ctshk.rpc.hotel.req.chimeLongPriceDate.TargetPersonInfoData;
import com.ctshk.rpc.hotel.service.IChimeLongAPIService;
import com.ctshk.rpc.hotel.service.IHotelOrderService;
import com.github.houbb.heaven.util.util.CollectionUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;

import static com.ctshk.rpc.hotel.APIUtils.APIUtil.callAPIFunc;

@DubboService
public class ChimeLongAPIServiceImpl implements IChimeLongAPIService {
    @Autowired
    private HotelMapper hotelMapper;
    @Autowired
    private HotelProductMapper hotelProductMapper;
    @Autowired
    private HotelRoomTypeMapper hotelRoomTypeMapper;
    @Autowired
    private HotelProductCostMapper hotelProductCostMapper;
    @Autowired
    private HotelProductCostDateMapper hotelProductCostDateMapper;
    private static final String merno = "9000000242";
    private static final String nonceStr = "80c5a87d22ed461bbe91ec691a4d9874";
    // 加签私钥
    private static final String PRIVATE_KEY ="MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCkC8DXIplbTY9f2ukvqny4y9kdOFV5/76GpnGX5VbjcVVrsiQRry8wA4LsoUV+YCgGx/83R19W/G0HA8dfDPbKu931x52IUgBcu/JZccJRZy5cmRC+VvY4ChL/etpiLJBG46nv1rkKlh723gzpStFgnKtVTatCkek3m38gfOo91x1+LnvrjSSlz9f6Oa5PUpPcXf7ZES/2bVCPWGB+uDMJ/nLRYQ1EEqIyFo9x4l77GYnyiuqPWrcuvr3YQ477aozpwuHJ74edch+CY8P9vOLpHCDoqA5yjTGerA6egq6FWZV+9urGjnMhWWUW3eu1LYKTuVfWxUgrB8XmPQclo7iZAgMBAAECggEAP0S5L0AM3YXgUhvf655ZU/xq1DYx4Uedd9kh3m95P2cqhsrB1oA2NtJj4FeiscbsKRFhgTRptObONfJjJmmdlTs3s981Bqp5sUpbgdu6EiM1Ykk2h/KKK7rW8Om06EA/tNeBZxrtawPTFWs2l5NfhV9nRRMbhiU4SVYThbgnr4lzbmgVqKe3EOkmDDNO3vmpnR+CVhr09HPJwO/QnqBal1tApWiqQmXd8jFsMkzOj/22YUXT18vCfnwzh0CN6/vc9s+Ua9IKv2tUWg/xbjphOmtsNB+6i5vxywOt5Ly4c4UmE+doTWcjvfjEIemIB8n1QAKF+lgvtNMC3kP8t2nGAQKBgQDyTMExCDHiEzcJdgrUHlYwagRn7CP6BISttQ0tLaHuzLoJH1FCvwqIyPX8YVchaC3gRpzHfaFanvHRm0d4ftqxi1pmU7XF+RZ1Mf90ydKQw1oJchQfTkE7E7Iygit7RbAimnTkDpg3cUxx0UglGqNF/FgI3zfZknRp3U4tZQ3JUQKBgQCtUkmkAjaZTdg4Pa1XrTup1GEhYbY0NXn5N/F9Tw0t63QOSsgL4E45LApZavVLTLWN4+BPk4fpr3RCsqxjK/bKSSyH/IAZ3S0osx5O+m3+KA+Q4mxoPbaozzmeHzsnQSUJd8G1znO64u3vzRVUqyFMVLLMynCbT9PmQF20KZwoyQKBgErPzhqgiB5ghm7CZqeF0mDSaxfXPmh0uq6Tp0TawRPlXE9yvvlX2R3QxrqtJ2TmMLv9sWya6pX7W3i3dALNUCLffwL3N7mvpfJ7hH9/zSbrWkJuWa4s0FE4TJ3xuREvvCmC/TJpGzCLJ+pAjwD9z4nNVzUuDqV75bvGG9xCRlZxAoGAWgCRHQnJMHKsBQiCKzVZ9ibDCYKkCxh57mCOlnOmdGIAMivDFee0txuXhDd2iVOcM8JRiQEjYsYpqTj/K8B4tzKoXTVRkBy6hpf89SY2V/SVoLbzdG4XnDF/ygyNuySpBvGZNb+veSy+QfhNS1pSQED7WD0HnJ8nejmSbyvsW4ECgYA6z3JnS/3czIHEFpkpYJVaxlQd4/IAMKl7p+ObMf5ecyH74wPk97pLUovnIJcBbmsFDApUobKsUJzg7uJ7vwHwaHWy+w8ErM/xocw+/GD2ODpmMCBEcK50MKFMoZEkM98uYqyFCcVjLj2faqDk9u+RL/C5eusjpuRElLTwg4NaVw==";
    // 验签公钥
    private static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtryK7CNlknTADodbiK8vR8jSQXFSwatXjwAY2XkW/tHyAT4+yrQAoqc+gJnrP51Mm+xGbH6gp6nWy+AYF7xaVqqwWM8+BjOu4hj8ZSZ3qm7A2vP7CCBDr7piXBr6GIWSygEuWhrd24oDRZya6AqZTsyPmBziTfWhqjtdBvymPNwIDAQAB";
    //请求格式
    private static final String REQUEST_FORMAT ="application/json;charset=utf-8";
    //请求路径
    private static final String REQUEST_URL_PATH = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
    //加密key（chimelong support the key）
    private static final String SIGN_KEY  = "1d70b9997df4946824810ebb069dbe28";//长隆提供
    private static final String contentType = "application/json;charset=utf-8";
    /*methods*/
    //获取全部酒店参数
    private static final String chimelong_hotel_hotel_info_get ="chimelong.hotel.hotel.info.get";
    //获取全部酒店产品
    private static final String chimelong_hotel_product_info_get ="chimelong.hotel.product.info.get";

    //删除标识 0：未删除，1：已删除
    private static final Integer NO_DELETE  = 0;
    private static final Integer YES_DELETE  = 1;

    //来源 1：手动，2：API
    private static final Integer SOURCE_TYPE_OWN  = 1;
    private static final Integer SOURCE_TYPE_API  = 2;

    //是否是免费WIFI 1：不是，2：是
    private static final Integer IS_FREE_NO  = 1;
    private static final Integer IS_FREE_YES  = 2;


    /**
     *拉取长隆API酒店
     * */
    public Result saveAPIChimeLongHotel(TokenUser user) {
//        String CONTENT_WITH_NO_SIGN ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.product.info.get\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-12 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{\\\"productCodes\\\":[\\\"GGZH001BPK0002_1000000423\\\"]}}\"}";
        String CONTENT_WITH_NO_SIGN ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.hotel.info.get\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-12 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{}}\"}";
        String signAppendStr = new APISignUtil().contentJointTest(CONTENT_WITH_NO_SIGN);
        String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
        String params =
                "{" +
                        "\"mer_no\":\"9000000242\","+
                        "\"data\":\""+toData+"\""+
                        "}";
        String contentType = "application/json;charset=utf-8";
        String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
        String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
        System.out.println(returnStr);
        JSONObject j = new JSONObject(returnStr);
        JSONArray hotelDate = j.getJSONObject("body").getJSONArray("hotelData");
        List<ChimeLongHotelDTO> chimeLongHotelDTOs = (List<ChimeLongHotelDTO>) JSON.parseArray(String.valueOf(hotelDate), ChimeLongHotelDTO.class);
        for (int i = 0; i <chimeLongHotelDTOs.size() ; i++) {
            String chimeLongHotel = chimeLongHotelDTOs.get(i).getAddress();
            Hotel hotel = new Hotel();
            hotel.setSourceType(SOURCE_TYPE_API);
            hotel.setId(IdWorker.getId());
            hotel.setBrandName("长隆");
            hotel.setCountryId(null);
            hotel.setCountryName("中国");
            hotel.setProvinceId(null);
            hotel.setProvinceName("广东省");
            hotel.setCityId(null);
            if(chimeLongHotelDTOs.get(i).getRegionId().equals("GZ")){
                hotel.setCityName("广州市");
                hotel.getAreaId();
                hotel.setAreaName("番禺区");
            }else if(chimeLongHotelDTOs.get(i).getRegionId().equals("ZH")){
                hotel.setCityName("珠海市");
                hotel.setAreaName("横琴新区");
                hotel.getAreaId();
            }
            hotel.setSourceType(2);//1：
            JSONObject jsonHotelName = new JSONObject(chimeLongHotelDTOs.get(i).getHotelName());
            hotel.setEnName(jsonHotelName.get("en").toString());
            hotel.setName(jsonHotelName.get("zh").toString());
            JSONObject jsonHotelAddress = new JSONObject(chimeLongHotelDTOs.get(i).getAddress());
            hotel.setStarLevel(chimeLongHotelDTOs.get(i).getStarLevel());
            hotel.setTelephone(chimeLongHotelDTOs.get(i).getPhone());
            hotel.setLocation(jsonHotelAddress.get("zh").toString());
            hotel.setCreateId(user.getId());
            hotel.setGmtCreate(LocalDateTime.now());
            hotel.setIsDeleted(NO_DELETE);
            hotel.setHotelCode(chimeLongHotelDTOs.get(i).getHotelCode());
            hotelMapper.insert(hotel);
        }
        return Result.success();
    }

    /**
     *拉取长隆API酒店
     * */
    @Override
    public Result getAPIChimeLongHotelProductByCode(List<String> productCodeList, TokenUser user) {
//        String productCodeParam = "";
//        //["G202TSTAE00198_1000000425"]
//        if(productCodeList!=null){
//            for (int i = 0; i <productCodeList.size() ; i++) {
//                String productCode = productCodeList.get(i);
//                productCodeParam = productCodeParam+",\\\""+productCode+"\\\"";
//            }
//            productCodeParam = productCodeParam.substring(1);
//        }else{
//            productCodeParam = "[]";
//        }
//        productCodeParam = "\"productCodes\""+":["+productCodeParam+"]";
        if(CollectionUtils.isNotEmpty(productCodeList)) {
            for (int m = 0; m <productCodeList.size() ; m++) {
                String productCode = productCodeList.get(m);
                String requestParam = "{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.product.info.get\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-12 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{\\\"productCodes\\\":[\\\""+productCode+ "\\\"]}}\"}";
                String signAppendStr = new APISignUtil().contentJointTest(requestParam);
                String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
                String params =
                        "{" +
                                "\"mer_no\":\"9000000242\"," +
                                "\"data\":\"" + toData + "\"" +
                                "}";
                String contentType = "application/json;charset=utf-8";
                String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
                String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType, path, params, "POST"), "1d70b9997df4946824810ebb069dbe28");
                System.out.println(returnStr);
                //根据hotelCode将产品录入数据库
                JSONObject j = new JSONObject(returnStr);
                JSONArray productData = j.getJSONObject("body").getJSONArray("productData");
                List<ProductData> productDataList = JSONUtil.toList(productData, ProductData.class);
                for (int i = 0; i < productDataList.size(); i++) {
                    ProductData productDataObj = productDataList.get(i);
                    HotelProduct hotelProduct = new HotelProduct();
                    //现根据HotelCode将产品绑定相关酒店
                    if (productDataObj.getHotelCode().equals("GZH001")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "广州长隆酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("GZH002")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "广州熊猫酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("GZH003")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "广州长隆香江酒店（长隆野生动物世界店）");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("GZH004")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "番禺香江大酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("ZHH001")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "珠海长隆横琴湾酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("ZHH002")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "珠海长隆马戏酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("ZHH003")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "珠海长隆企鹅酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("ZHH004")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "珠海长隆迎海酒店公寓");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    } else if (productDataObj.getHotelCode().equals("ZHH005")) {
                        QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                        queryWrapper.lambda().eq(Hotel::getName, "珠海长隆海洋科学酒店");
                        queryWrapper.lambda().eq(Hotel::getIsDeleted, NO_DELETE);
                        Hotel hotel = hotelMapper.selectOne(queryWrapper);
                        hotelProduct.setHotelId(hotel.getId());
                    }
                    hotelProduct.setId(IdWorker.getId());
                    hotelProduct.setAllowPackage(null);
                    hotelProduct.setChargeUser(user.getUsername());//默认当前用户
                    hotelProduct.setChargeId(user.getId());
                    hotelProduct.setCreateId(user.getId());
                    hotelProduct.setAllowRefund(null);
                    hotelProduct.setApprovalStatus(null);
                    hotelProduct.setCancelStatus(null);
                    hotelProduct.setCustomerNotice(null);
                    hotelProduct.setHasBreakfast(null);
                    hotelProduct.setIsDeleted(NO_DELETE);
                    hotelProduct.setIsSecCheck(null);
                    hotelProduct.setMinPrice(null);
                    JSONObject jsonHotelName = new JSONObject(productDataObj.getProductName());
                    hotelProduct.setName(jsonHotelName.get("zh").toString());
                    hotelProduct.setOnShelfStatus(null);
                    hotelProduct.setPaymentStatus(null);
                    hotelProduct.setProductType(null);
                    hotelProduct.setGmtCreate(null);
                    hotelProduct.setIsRecommend(null);
                    hotelProduct.setRefundCharge(null);
                    hotelProduct.setRefundChargeType(null);
                    hotelProduct.setReserveChargeType(null);
                    hotelProduct.setReserveCharge(null);
                    hotelProduct.setRoomId(null);
                    hotelProduct.setSaleBegin(productDataObj.getSaleBegDate());
                    hotelProduct.setSaleEnd(null);
                    hotelProduct.setSaleStatus(null);
                    hotelProduct.setSaleTimeType(null);
                    hotelProduct.setScheduledStatus(null);
                    hotelProduct.setSource(null);
                    hotelProduct.setSourceType(SOURCE_TYPE_API);
                    hotelProduct.setStatus(null);
                    hotelProduct.setSupplierId(null);
                    hotelProduct.setSupplierName("长隆");
                    hotelProduct.setTargetPopulation(null);
                    hotelProduct.setTargetPopulationId(null);
                    hotelProduct.setTaxation(null);
                    hotelProduct.setThemeJson(null);
                    hotelProduct.setProductCode(productCode);
                    hotelProductMapper.insert(hotelProduct);
                    //添加酒店产品房型信息
                    JSONArray roomData = j.getJSONObject("body").getJSONArray("productData");
                    System.out.println(roomData);
                    if (productDataObj.getRoomData() != null) {
                        for (int k = 0; k < productDataObj.getRoomData().size(); k++) {
                            RoomData roomDataObj = productDataObj.getRoomData().get(k);
                            HotelRoomType hotelRoomType = new HotelRoomType();
                            hotelRoomType.setId(IdWorker.getId());
                            hotelRoomType.setHotelId(hotelProduct.getHotelId());
                            hotelRoomType.setAllowSmoke(null);
                            hotelRoomType.setAreaMeasure(null);
                            hotelRoomType.setBedType(roomDataObj.getBedTypeName().getZh_TW());
                            hotelRoomType.setBedTypeId(null);
                            hotelRoomType.setCanAddBed(null);
                            hotelRoomType.setCoverImg(null);
                            hotelRoomType.setCustomerGuide(null);
                            hotelRoomType.setEnName(roomDataObj.getProductName().getEn());
                            hotelRoomType.setHasWindow(null);
                            hotelRoomType.setIsDeleted(NO_DELETE);
                            if (roomDataObj.getHasInternet() != false) {
                                hotelRoomType.setIsFreeNet(2);
                                hotelRoomType.setNetType("wifi/有限");
                                hotelRoomType.setNetTypeId(null);
                            }
                            hotelRoomType.setMaxAdult(null);
                            hotelRoomType.setMaxChildren(null);
                            if (roomDataObj.getProductName().getZh_TW() != null && !roomDataObj.getProductName().getZh_TW().equals("")) {
                                hotelRoomType.setName(roomDataObj.getProductName().getZh_TW());
                            } else {
                                hotelRoomType.setName(roomDataObj.getProductName().getZh());
                            }
                            hotelRoomType.setPhotoJson(null);
                            hotelRoomType.setRoomFloors(null);
                            hotelRoomType.setRoomIntroduction(null);
                            hotelRoomType.setRoomNum(null);
                            hotelRoomType.setRoomType(null);
                            hotelRoomType.setRoomTypeId(null);
                            hotelRoomType.setGmtCreate(LocalDateTime.now());
                            hotelRoomType.setCreateId(user.getId());
                            hotelRoomTypeMapper.insert(hotelRoomType);
                        }
                    }
                    //保存产品当天的价格和库存
                    String begDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                    String endDay = LocalDateTime.now().plusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                    ChimeLongProductPriceAndStockReq chimeLongProductPriceAndStockReq = new ChimeLongProductPriceAndStockReq();
                    chimeLongProductPriceAndStockReq.setBegDate(begDate);
                    chimeLongProductPriceAndStockReq.setEndDate(endDay);
                    chimeLongProductPriceAndStockReq.setProductCode(productCode);
                    getProductPriceChimeLong(chimeLongProductPriceAndStockReq,user);
                }
            }
        }else{
            return Result.failed(SystemError.HOTEL_10042);
        }
        return Result.success();
    }

    //拉取长隆酒店价格和库存
    @Override
    public Result getProductPriceChimeLong(ChimeLongProductPriceAndStockReq chimeLongProductPriceReq, TokenUser user) {
        if(chimeLongProductPriceReq.getProductCode()==null){
            return Result.failed(SystemError.HOTEL_10035);
        }else if(chimeLongProductPriceReq.getBegDate()==null){
            return Result.failed(SystemError.HOTEL_10036);
        }else if(chimeLongProductPriceReq.getEndDate()==null){
            return Result.failed(SystemError.HOTEL_10037);
        }
        //productCode   GGZH002TST0033_1000000418
        String param = "";
        String CONTENT_WITH_NO_SIGN ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.product.price.get\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-26 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{\\\"getData\\\":[{\\\"productCode\\\":\\\""+chimeLongProductPriceReq.getProductCode()+"\\\",\\\"begDate\\\":\\\""+chimeLongProductPriceReq.getBegDate()+"\\\",\\\"endDate\\\":\\\""+chimeLongProductPriceReq.getEndDate()+"\\\"}]}\"}";
        String signAppendStr = new APISignUtil().contentJointTest(CONTENT_WITH_NO_SIGN);
        String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
        String params =
                "{" +
                        "\"mer_no\":\"9000000242\","+
                        "\"data\":\""+toData+"\""+
                        "}";
        String contentType = "application/json;charset=utf-8";
        String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
        String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
        JSONObject j = new JSONObject(returnStr);
        Object  code = j.get("code");
        if(code==null){
            return Result.failed(SystemError.HOTEL_10038);
        }else{
            if(code.equals("10000")) {
                JSONArray priceData = j.getJSONObject("body").getJSONArray("priceData");
                if(priceData!=null){
                    List<PriceData> priceDataList = (List<PriceData>) JSON.parseArray(String.valueOf(priceData), PriceData.class);
                    if (priceDataList != null) {
                        for (int i = 0; i < priceDataList.size(); i++) {
                            PriceData priceDataObj = priceDataList.get(i);
                            //通过productCode查询hotelProduct的productCode。得到hotelProduct的id
                            QueryWrapper<HotelProduct> queryWrapper = new QueryWrapper<>();
                            queryWrapper.lambda().eq(HotelProduct::getId, priceDataObj.getProductCode());
                            queryWrapper.lambda().eq(HotelProduct::getIsDeleted, IsDeletedCode.NO.getCode());
                            List<HotelProduct> hotelProduct = hotelProductMapper.selectList(queryWrapper);
                            if (hotelProduct != null) {
                                HotelProduct hotelProduct1 = hotelProduct.get(0);
                                HotelProductCost hotelProductCost = new HotelProductCost();
                                hotelProductCost.setHotelProductId(hotelProduct1.getId());
                                hotelProductCost.setId(IdWorker.getId());
                                hotelProductCost.setCostName("长隆产品编号" + priceDataObj.getProductCode() + "成本和库存信息");
                                hotelProductCost.setCurrencyId(null);
                                hotelProductCost.setCurrencyName(priceDataObj.getCurrency());
//                                hotelProductCost.setProductCode(priceDataObj.getProductCode());
                                // TODO 类型问题临时注释 hotelProductCost.setPrice(priceDataObj.getFixPrice());
                                //查询产品库存
                                List<StockData> stockData = getProductStockChimeLong(chimeLongProductPriceReq);
                                for (int k = 0; k < stockData.size(); k++) {
                                    StockData stockDataObj = stockData.get(k);
                                    if (stockDataObj.getProductCode() == priceDataObj.getProductCode()) {//如果是同一个产品
                                        hotelProductCost.setStock(stockDataObj.getStock());
                                    }
                                }
                                //返回/保存查询接口得到的库存和价格
                                hotelProductCostMapper.insert(hotelProductCost);
                                //添加产品时效性
                                HotelProductCostDate hotelProductCostDate = new HotelProductCostDate();
                                hotelProductCostDate.setCostId(hotelProductCost.getId());
                                hotelProductCostDate.setId(IdWorker.getId());
                                //存上当天日期
                                hotelProductCostDate.setDateBegin(LocalDate.now());
                                hotelProductCostDate.setDateEnd(LocalDate.now().plusDays(1));
                                hotelProductCostDateMapper.insert(hotelProductCostDate);
                            } else {
                                return Result.failed(SystemError.HOTEL_10039);
                            }
                        }
                    }else{
                        return Result.failed(SystemError.HOTEL_10043);
                    }
                }
            }else {
                return Result.failed(SystemError.HOTEL_10043);
            }
        }
        return Result.success();
    }


//    @Override  按照日期获取库存
    public static List<StockData> getProductStockChimeLong(ChimeLongProductPriceAndStockReq chimeLongProductPriceAndStockReq) {
        //productCode   GGZH002TST0033_1000000418
        String param = "";
        String CONTENT_WITH_NO_SIGN ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.product.price.get\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec961a4d9874\",\"timestamp\":\"2021-03-26 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{\\\"getData\\\":[{\\\"productCode\\\":\\\""+chimeLongProductPriceAndStockReq.getProductCode()+"\\\",\\\"begDate\\\":\\\""+chimeLongProductPriceAndStockReq.getBegDate()+"\\\",\\\"endDate\\\":\\\""+chimeLongProductPriceAndStockReq.getEndDate()+"\\\"}]}\"}";
        String signAppendStr = new APISignUtil().contentJointTest(CONTENT_WITH_NO_SIGN);
        String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
        String params =
                "{" +
                        "\"mer_no\":\"9000000242\","+
                        "\"data\":\""+toData+"\""+
                        "}";
        String contentType = "application/json;charset=utf-8";
        String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
        String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
        List<StockData> stockDataList = null;
        if(!returnStr.equals("")||returnStr!=null){
            JSONObject j = new JSONObject(returnStr);
            JSONArray stockData = j.getJSONObject("body").getJSONArray("stockData");
            stockDataList = (List<StockData>) JSON.parseArray(String.valueOf(stockData), StockData.class);
        }
        return stockDataList;
    }

    /*拼接请求字符串*/
    public static String appendReqStr(String method,String params){
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
        String nowDate = df.format(new Date().getTime());
        if(StringUtils.isNotBlank(method)&&StringUtils.isNotBlank(merno)&&StringUtils.isNotBlank(nonceStr)){
            String reqStr = "{\"mer_no\":\""+merno+"\",\"method\":\""+method+"\",\"nonce_str\":\""+nonceStr+"\",\"timestamp\":\""+nowDate+"\",\"ver_no\":\"1.0\",\"body\":\"{"+params+"}\"}";;
            return reqStr;
        }else{
            return null;
        }
    }

    /**
     * 长隆订单创建
     * */
    @Override
    public Result chimeLongOrderCreate(ChimeLongCreateOrderPreDTO chimeLongCreateOrderPreDTO, TokenUser user) {
        String CREATEORDER ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.order.create\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-12 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{" +
                "\\\"otaOrderId\\\": \\\""+chimeLongCreateOrderPreDTO.getOtaOrderId()+"\\\"," +
                "\\\"name\\\": \\\""+chimeLongCreateOrderPreDTO.getName()+"\\\"," +
                "\\\"mobile\\\": \\\""+chimeLongCreateOrderPreDTO.getMobile()+"\\\"," +
                "\\\"orderMoney\\\": \\\""+chimeLongCreateOrderPreDTO.getOrderMoney()+"\\\"," +
                "\\\"currency\\\": \\\""+chimeLongCreateOrderPreDTO.getCurrency()+"\\\"," +
                "\\\"productData\\\": [{" +
                "\\\"productCode\\\": \\\""+chimeLongCreateOrderPreDTO.getProductData().get(0).getProductCode()+"\\\"," +
                "\\\"begDate\\\": \\\""+chimeLongCreateOrderPreDTO.getProductData().get(0).getBegDate()+"\\\"," +
                "\\\"endDate\\\": \\\""+chimeLongCreateOrderPreDTO.getProductData().get(0).getEndDate()+"\\\"," +
                "\\\"settlePrice\\\": "+chimeLongCreateOrderPreDTO.getProductData().get(0).getSettlePrice()+"," +
                "\\\"otaPrice\\\": "+chimeLongCreateOrderPreDTO.getProductData().get(0).getOtaPrice()+"," +
                "\\\"quantity\\\": "+chimeLongCreateOrderPreDTO.getProductData().get(0).getQuantity()+"," +
                "\\\"totalMoney\\\": "+chimeLongCreateOrderPreDTO.getProductData().get(0).getTotalMoney()+"," +
                "\\\"personInfoData\\\": [{" +
                "\\\"name\\\": \\\""+chimeLongCreateOrderPreDTO.getProductData().get(0).getPersonInfoData().get(0).getName()+"\\\"," +
                "\\\"mobile\\\": \\\""+chimeLongCreateOrderPreDTO.getProductData().get(0).getPersonInfoData().get(0).getMobile()+"\\\"" +
                "}]" +
                "}]" +
                "}\"}";
        String signAppendStr = new APISignUtil().contentJointTest(CREATEORDER);
        String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
        String params =
                "{" +
                        "\"mer_no\":\"9000000242\","+
                        "\"data\":\""+toData+"\""+
                        "}";
        String contentType = "application/json;charset=utf-8";
        String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
        String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
        System.out.println(returnStr);
        //保存酒店订单
        HotelOrderReq hotelOrderReq = new HotelOrderReq();
        hotelOrderReq.setId(chimeLongCreateOrderPreDTO.getOtaOrderId());
//        hotelOrderReq.setAgencyId();
//        hotelOrderReq.setAgentUserName();
//        hotelOrderReq.setCancelStatus();
//        hotelOrderReq.setContactEmail();
//        hotelOrderReq.setContactMobile();
//        hotelOrderReq.setAgencyCompany();
//        hotelOrderReq.setContactMobileAreaCode();
//        hotelOrderReq.setContactMobileAreaCodeId();
//        hotelOrderReq.setContactName();
//        hotelOrderReq.setCouponId();
//        hotelOrderReq.setCreateId();
//        hotelOrderReq.setDepartureDate();
//        hotelOrderReq.setEffectiveDate();
//        hotelOrderReq.setGender();
//        hotelOrderReq.setHasBreakfast();
//        hotelOrderReq.setHotelName();
//        hotelOrderReq.setHotelProductId();
//        hotelOrderReq.setHotelProductName();
//        hotelOrderReq.setIsAgent();
//        hotelOrderReq.setIsDeleted();
//        hotelOrderReq.setMemberId();
//        hotelOrderReq.setMemberQueryCertificatesType();
//        hotelOrderReq.setMemberQueryCode();
//        hotelOrderReq.setMemberQueryType();
//        hotelOrderReq.setMemberType();
//        hotelOrderReq.setModifiedId();
//        hotelOrderReq.setName();
//        hotelOrderReq.setNumber();
//        hotelOrderReq.setOrderAmount();
//        hotelOrderReq.setOrderNumber();
//        hotelOrderReq.setPayExpireDate();
//        hotelOrderReq.setPaymentStatus();
//        hotelOrderReq.setProductType();




//        hotelOrderService.saveHotelOrder(hotelOrderReq,user.getId());
        if(!returnStr.contains("body")){
            JSONObject j = new JSONObject(returnStr);
            JSONObject stockData = j.getJSONObject("msg");
            System.out.println(stockData);
            return Result.failed(SystemError.HOTEL_10050);
        }else{
            JSONObject j = new JSONObject(returnStr);
            JSONObject stockData = j.getJSONObject("body");
            return Result.success(stockData.get("chimeOrderId").toString());
        }
    }
/*
*
* */
    /**
     * 长隆订单修改
     * */
    @Override
    public Result chimelongOrderUpdate(ChimeLongOrderUpdateReq chimeLongOrderUpdateReq, TokenUser user) {
        String appendBodyParams = "";
        if(chimeLongOrderUpdateReq!=null){
            String otaOrderId ="\"otaOrderId\":\""+chimeLongOrderUpdateReq.getOtaOrderId()+"\",";
            String chimeOrderId ="\"chimeOrderId\":\""+chimeLongOrderUpdateReq.getChimeOrderId()+"\",";
            String currency ="\"currency\":\""+chimeLongOrderUpdateReq.getCurrency()+"\",";
            appendBodyParams = otaOrderId+chimeOrderId+currency;
            String productDataArr = "";
            String targetPersonInfoDataArr = "";
            String personAccompanyingArr = "";
            if(CollectionUtil.isNotEmpty(chimeLongOrderUpdateReq.getProductDataList())){
                for (int i = 0; i < chimeLongOrderUpdateReq.getProductDataList().size(); i++) {
                    com.ctshk.rpc.hotel.req.chimeLongPriceDate.ProductData productDataObj = chimeLongOrderUpdateReq.getProductDataList().get(i);
                    String targetProductCode = "\"targetProductCode\":\"" + productDataObj.getTargetProductCode() + "\",";
                    String targetBegDate = "\"targetBegDate\":\"" + productDataObj.getTargetBegDate() + "\",";
                    String targetEndDate = "\"targetEndDate\":\"" + productDataObj.getTargetEndDate() + "\",";
                    String targetSeasonCode = "\"targetSeasonCode\":\"" + productDataObj.getTargetSeasonCode() + "\",";
                    String targetOtaPrice = "\"targetOtaPrice\":\"" + productDataObj.getTargetOtaPrice() + "\",";
                    String targetSettlePrice = "\"targetSettlePrice\":\"" + productDataObj.getTargetSettlePrice() + "\",";
                    String targetQuantity = "\"targetQuantity\":\"" + productDataObj.getTargetQuantity() + "\",";
                    String targetAddBedNum = "\"targetAddBedNum\":\"" + productDataObj.getTargetAddBedNum() + "\",";
                    String targetAdults = "\"targetAdults\":\"" + productDataObj.getTargetAdults() + "\",";
                    String targetChildren = "\"targetChildren\":\"" + productDataObj.getTargetChildren() + "\",";
                    productDataArr = targetProductCode + targetBegDate + targetEndDate + targetSeasonCode + targetOtaPrice + targetSettlePrice + targetQuantity + targetAddBedNum + targetAdults + targetChildren;
                    if (CollectionUtil.isNotEmpty(productDataObj.getTargetPersonInfoDataList())) {
                        for (int j = 0; j <productDataObj.getTargetPersonInfoDataList().size() ; j++) {
                            TargetPersonInfoData targetPersonInfoData = productDataObj.getTargetPersonInfoDataList().get(j);
                            String firstName = "\"firstName\":\"" + targetPersonInfoData.getFirstName() + "\",";
                            String lastName = "\"lastName\":\"" + targetPersonInfoData.getLastName() + "\",";
                            String name = "\"name\":\"" + targetPersonInfoData.getName() + "\",";
                            String mobile = "\"mobile\":\"" + targetPersonInfoData.getMobile() + "\",";
                            String certCardType = "\"certCardType\":\"" + targetPersonInfoData.getCertCardType() + "\",";
                            String certCardNo = "\"certCardNo\":\"" + targetPersonInfoData.getCertCardNo() + "\",";
                            String email = "\"email\":\"" + targetPersonInfoData.getEmail() + "\",";
                            targetPersonInfoDataArr = firstName+lastName+name+mobile+certCardType+certCardNo+email;
                            if(CollectionUtil.isNotEmpty(targetPersonInfoData.getPersonAccompanyingList())){
                                for (int k = 0; k < targetPersonInfoData.getPersonAccompanyingList().size(); k++) {
                                    PersonAccompanying personAccompanying = targetPersonInfoData.getPersonAccompanyingList().get(k);
                                    String firstNameAccompanying = "\"firstName\":\"" + personAccompanying.getFirstName() + "\",";
                                    String lastNameAccompanying = "\"lastName\":\"" + personAccompanying.getLastName() + "\",";
                                    String nameAccompanying = "\"name\":\"" + personAccompanying.getName() + "\",";
                                    String mobileAccompanying = "\"mobile\":\"" + personAccompanying.getMobile() + "\",";
                                    String mobileRegionAccompanying = "\"mobileRegion\":\"" + personAccompanying.getMobileRegion() + "\",";
                                    String certCardTypeAccompanying = "\"certCardType\":\"" + personAccompanying.getCertCardType() + "\",";
                                    String certCardNoAccompanying = "\"certCardNo\":\"" + personAccompanying.getCertCardNo() + "\",";
                                    String emailAccompanying = "\"email\":\"" + personAccompanying.getEmail() + "\"";
                                    personAccompanyingArr = firstNameAccompanying+lastNameAccompanying+nameAccompanying+mobileAccompanying+mobileRegionAccompanying+certCardTypeAccompanying+certCardNoAccompanying+emailAccompanying;
                                }
                            }
                        }
                    }
                }
            }
            //productDataArr targetPersonInfoDataArr personAccompanyingArr
            targetPersonInfoDataArr = targetPersonInfoDataArr+"\"personAccompanying\":[{"+personAccompanyingArr+"}]";
            productDataArr = productDataArr+"\"targetPersonInfoData\":[{"+targetPersonInfoDataArr+"}]";
            appendBodyParams = appendBodyParams+"\"productData\":[{"+productDataArr+"}]";
            //appendBodyParams = "{"+appendBodyParams+"}";
            System.out.println(appendBodyParams);
            //调用接口
            String cancelOrder ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.order.change\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-26 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{\\\""+appendBodyParams+"\\\"}\"}";
            String signAppendStr = new APISignUtil().contentJointTest(cancelOrder);
            String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
            String params =
                    "{" +
                            "\"mer_no\":\"9000000242\","+
                            "\"data\":\""+toData+"\""+
                            "}";
            String contentType = "application/json;charset=utf-8";
            String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
            String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
            //解析返回结果
            if(returnStr.contains("body")){
                //修改订单数据  （可能需要判断订单状态，是否允许修改，暂未做）
//                QueryWrapper<Hotel> queryWrapper  = new QueryWrapper<>();
//                Result<HotelOrderDTO> hotelOrderDTOResult = hotelOrderService.queryHotelOrderById(chimeLongOrderUpdateReq.getOtaOrderId());
//                HotelOrderDTO hotelOrderDTO = hotelOrderDTOResult.getData();
//                HotelOrderReq hotelOrderReq = EntityUtil.copy(hotelOrderDTO, HotelOrderReq.class);
//                hotelOrderService.editHotelOrder(hotelOrderReq,user.getId());
                JSONObject j = new JSONObject(returnStr);
                JSONObject stockData = j.getJSONObject("body");
                return Result.success(stockData.get("chimeOrderId").toString());
            }else{
                return Result.failed(SystemError.HOTEL_10082);
            }
        }else{
            return Result.failed(SystemError.HOTEL_10081);
        }
    }

    /**
     * 长隆订单取消
     * */
    @Override
    public Result chimeLongOrderCancel(String chimeLongIdOrOtaId, TokenUser user) {
        String cancelOrder ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.order.cancel\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-26 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{\\\"chimeOrderId\\\":\\\""+chimeLongIdOrOtaId+"\\\"}\"}";

        String signAppendStr = new APISignUtil().contentJointTest(cancelOrder);
        String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
        String params =
                "{" +
                        "\"mer_no\":\"9000000242\","+
                        "\"data\":\""+toData+"\""+
                        "}";
        String contentType = "application/json;charset=utf-8";
        String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
        String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
        System.out.println(returnStr);

        if(!returnStr.contains("body")){
            return Result.failed(SystemError.HOTEL_10051);
        }else{
            return Result.success(returnStr);
        }
    }

    /**
     * 长隆协议获取
     * */
    @Override
    public Result<List<ProxyDatas>> chimeLongGetProtocal(ChimelongProtocalReq chimelongProtocalReq, TokenUser user) {
        String GET_CHIMELONG_PRODUCT_PROXY ="{\"mer_no\":\"9000000242\",\"method\":\"chimelong.hotel.proxy.info.get\",\"sign\":\"\",\"nonce_str\":\"80c5a87d22ed461bbe91ec691a4d9874\",\"timestamp\":\"2021-03-12 10:13:01\",\"ver_no\":\"1.0\",\"body\":\"{}\"}";
        String signAppendStr = new APISignUtil().contentJointTest(GET_CHIMELONG_PRODUCT_PROXY);
        String toData = new APIAesUtil().aesEncodeBase64(signAppendStr, "1d70b9997df4946824810ebb069dbe28");//SIGN_KEY:"1d70b9997df4946824810ebb069dbe28"（长隆提供）
        String params =
                "{" +
                        "\"mer_no\":\"9000000242\","+
                        "\"data\":\""+toData+"\""+
                        "}";
        String contentType = "application/json;charset=utf-8";
        String path = "http://47.244.225.190:8080/hub/product/ota/call2/gsa/chimelong/api.do";
        String returnStr = new APIAesUtil().aesDecodeBase64(callAPIFunc(contentType,path,params,"POST"), "1d70b9997df4946824810ebb069dbe28");
        if(!returnStr.contains("body")){
            return Result.failed(SystemError.HOTEL_10051);
        }else{
            JSONObject j = new JSONObject(returnStr);
            JSONArray jsonArray = j.getJSONObject("body").getJSONArray("proxyDatas");
            List<ProxyDatas> chimeLongProxy = (List<ProxyDatas>) JSON.parseArray(String.valueOf(jsonArray), ProxyDatas.class);
            return Result.success(chimeLongProxy);
        }
    }
}